using Pdf2epub.BusinessLogic.Extractors;
using Pdf2epub.Interfaces;
using System.Globalization;
using System.IO;

namespace Pdf2epub.BusinessLogic
{
    public class ExtractorFactory
    {
        public static IExtractor GetExtractor(IProjectContext projectContext, string path, string targetPath)
        {
            string extention = Path.GetExtension(path);
            if (string.IsNullOrEmpty(extention))
                return null;

            string extension = extention.ToLower(CultureInfo.InvariantCulture).Trim('.');

            switch (extension)
            {
                case "pdf":
                    return new PdfHtmlExtractor(projectContext, path);
                case "zip":
                    return new GalileoOpenBookExtractor(projectContext, path);
            }
            return null;
        }
    }
}